<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>10.map集合.html</title>
</head>
<body>

    <script>
        /*
         普通对象: key 都是字符串类型的
         Map 结构： key 可以是任意类型
        
        */
        const arr = [1,2,4]
        const user = {}
        const user02 = {}
        const map = new Map();
        // console.dir(map);

        map.set("name","小明")
        map.set(1,"小明")
        map.set("1","小红")
        map.set(user,"小明")
        map.set(user02,"小明")

        // map.clear()
        // map.delete("1")
        // console.log(map.has("11"));
        // map.forEach((value,key) => {
        //      console.log(key,value);
        // })
        const entries = map.entries();
       // console.log(entries);
        for(const [key,value] of entries) {
              console.log(key,value);
        }
        console.dir(map);



        console.log("==================");

        const obj = {
            name:"小明",
            0:"xxx",
            "0":"####",
            [arr]:"u",
            [user]:"xxx",
            [user02]:"xxx2"

        }
        const keys = Object.keys(obj)
        keys.forEach(key => {
             console.log(key,typeof key);
        })
    
    </script>
    
</body>
</html>